
#ifndef _UTIL_FRACTAL_H_
#define _UTIL_FRACTAL_H_
#include "xtypes.h"
#include "xmath.h"
#include "util_image.h"
#include "xstring.h"
#include "util_3d.h"
#include "util_3dx.h"

#include <stdlib.h>

#pragma warning(disable:4786)
#include <vector>
#include <map>
using namespace std;


typedef struct{
	CxString Axiom;		//the armstrong
	float_t Angle;		//the angle
	CxString strPr;		//the Productions	
}lsparam_t;

CxString ls_fnGenRegStr(lsparam_t lsp, int_t depth);
CxString ls_fnGenRandStr(lsparam_t lsp, int_t depth);
void Draw_LS_String(CxSphereCanvas& canvas, CxString str, uint_t xStart, uint_t yStart, int_t len, float_t angle_start, float_t angle);



typedef struct{
	float_t a;
	float_t b;
	float_t c;
	float_t d;
	float_t e;
	float_t f;
	float_t p;	
}ifsparam_t;

ifsparam_t fnGenIfsParam(CxString strIFS, float_t probability);
ifsparam_t fnGenIfsParam(CMatrix4x4 mt, float_t probability);
ifsparam_t fnSetIfsParam(float_t a, float_t b, float_t c, float_t d, float_t e, float_t f, float_t p);

void ExecuteIFS(CxSphereCanvas& canvas, window_t window, TxArray<ifsparam_t> ifs, float_t xstart, float_t ystart, int_t n);

void Do1DFractalFill(TxArray2<float_t>& canvas, int_t iterations, float_t initial_value, float_t H);
void Do2DFractalFill(TxArray2<float_t>& canvas, int_t iterations, float_t initial_value, float_t H);


void fnSplit(vector<CxString> & v, const CxString& src, CxString delimit, CxString null_subst="");


#endif //_UTIL_FRACTAL_H_
